package com.asp.controller;

import com.asp.entity.StudyResources;
import com.asp.entity.Subject;
import com.asp.result.Result;
import com.asp.service.StudyResourcesService;
import com.asp.service.StudyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * author:          ndg
 * date:            2024/1/11
 */
@RestController
@Slf4j
@Api(tags = "知识学习相关接口")
@RequestMapping("/user/study")
public class StudyController {

    @Autowired
    private StudyService studyService;

    @Resource
    private StudyResourcesService studyResourcesService;

    @GetMapping("/introduction")
    @ApiOperation(value = "学科介绍展示")
    public Result introduction() {
        log.info("学科介绍展示");
        List<Subject> subjectList = studyService.introduction();
        return Result.success(subjectList);
    }

    //获取学科资源
    @ApiOperation(value = "获取学科资源")
    @RequestMapping("/source")
    @ResponseBody
    public Result<List<StudyResources>> selectAllStudyResources(HttpServletRequest request) {
        List<StudyResources> studyResources = studyResourcesService.selectAllStudyResources();
        return Result.success(studyResources);
    }


}
